export const useStore = new defineStore('shop',{
    state()
    {
        return{
            business:{
                //给要存入数据的所有字段
                id:0,
                mobile:"0",
                adminid: '',
                auth:"0",
                avatar:"",
                avatar_text:"",
                city:"",
                city_text:"",
                createtime:0,
                createtime_text:"0",
                deal:"0",
                deletetime:null,
                district:"0",
                district_text:"0",
                email:"0",
                gender:"0",
                gender_text:"保密",
                money:"0",
                nickname:"0",
                openid:null,
                parentid:null,
                password:'',
                poster:null,
                poster_text:"0",
                province:"0",
                province_text:"0",
                region_text:"0",
                salt:"0",
                sourceid:0,
            },
            address:{}
        }
    },
    persist:{
        enabled:true,//开启数据持久化
        strategies:[
            {
                key: 'shop',//给一个要保存的名称
                storage: localStorage,//sessionStorage / localStorage 存储方式
            }
        ]
    }
})
//默认导出
export default {
    install(app)
    {
      //定义store接口 初始化
      const store = useStore()
      //获取数据
      const {business,address} = storeToRefs(store)
      app.config.globalProperties.$business = business
      app.config.globalProperties.$address = address
      app.config.globalProperties.$store = store
    }
  }